<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<%@ taglib tagdir="/WEB-INF/tags" prefix="matrix"%>
<%@ taglib uri="http://matrixcsm.zkingsoft.com" prefix="cms"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp">
<title data-index="0" id="selextTitle">${网页标题 }</title>
<meta name="keywords" content="${网页关键词}">
<meta name="description" content="${网页描述 }" />
<!--[if lt IE 8]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
<link
	href="${path }/resource/plugin/bootstrap-3.3.5/css/bootstrap.min.css"
	rel="stylesheet" type="text/css">
<link
	href="${path }/resource/plugin/font-awesome/css/font-awesome.min.css"
	rel="stylesheet" type="text/css">
<link href="${path }/resource/css/styleOne/animate.min.css"
	rel="stylesheet" type="text/css" />
<link href="${path }/resource/css/visitor/base.css" rel="stylesheet"
	type="text/css">
<link rel="shortcut icon" href="${浏览器logo }">
<link href="${path }/resource/css/visitor/index.css" rel="stylesheet"
	type="text/css">
	<style type="text/css">
	.listBox{
		margin-top: 15px;
		padding-bottom: 2px;
	}
	.listBox ul {
		margin-top: 5px;
			border-top: 1px solid #eee;
			padding-top: 10px;
	}
		.listBox ul li{
		color: #666;
		cursor: pointer;
		
		}
		.listBox ul li:HOVER {
		color: #a94442;
		text-decoration: underline;
}
#app{
min-height: 600px;
}
	</style>
</head>
<body class="">
	<jsp:include page="_top.jsp"></jsp:include>
	<div class="container" id="app">
		<br> <br>
		<div class="row">
			<div class="col-md-9">
				<div class="starter-template">
					<h3 class="text-danger">{{artTypeName}}</h3>
					<hr>
					<div class="row">
						<div class="col-md-12 " >
							<div v-for="art in arts" class="articlebox">
								<div class="time ">
									<span>{{art.artCreatetiem | getDate }}</span>
									<p>{{art.artCreatetiem | getYear }}</p>
								</div>
								<div class="abstract" v-on:click="toArticle(art.artId)">
									<h3>
										<a target="blank"
											:href="'${path}/redirect/article?id='+art.artId">
											{{art.artTitle}}</a>
									</h3>
									<p>
										<a target="blank"
											:href="'${path}/redirect/article?id='+art.artId">{{art.artAbstract}}</a>
									</p>
								</div>
							</div>
							<div class="abstract" v-bind:style="{display:more}">
								<p class="text-center">没有更多啦~</p>
							</div>
							<div class="row text-center">
								<i v-on:click="loadArt()" class="fa  fa-angle-double-down more"></i>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="col-md-3">
				<div class="listBox">
					<h3>分类</h3>
					<cms:artType var="type" code="新闻资讯"></cms:artType>
					<ul>
						<c:forEach items="${type }" var="item">
							<li v-on:click="changeType('${item.artTypeId }','${item.artTypeName }')" >${item.artTypeName }</li>
						</c:forEach>
					</ul>
				</div>
			</div>
		</div>
	</div>


	<jsp:include page="_foot.jsp"></jsp:include>
	<script type="text/javascript"
		src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
	<script type="text/javascript"
		src="${path }/resource/js/systools/AjaxProxy.js"></script>
	<script type="text/javascript"
		src="${path }/resource/plugin/bootstrap-3.3.5/js/bootstrap.min.js"></script>
	<script src="https://unpkg.com/vue/dist/vue.js"></script>
	<script>
		var app = new Vue({
			el : '#app',
			data : {
				offset : 0,
				limit : 10,
				more : "none",
				artTypeId:null,
				artTypeName:"最近更新",
				arts : []
			},
			filters : {
				getDate : function(value) {
					return new Date(value).getDate();
				},
				getYear : function(value) {
					var data = new Date(value);
					return data.getFullYear() + "/" + (data.getMonth() + 1);
				}
			},
			methods : {
				toArticle : function(id) {
					window.open("${path}/redirect/article?id=" + id);
				},
				loadArt : function() {
					$.AjaxProxy({
						c : false,
						p : {
							"offset" : app.offset,
							"limit" : app.limit,
							"artTypeId":app.artTypeId
						}
					}).invoke("${path}/findNews", function(loj) {
						if (loj.getValue("rows").length < 1) {
							app.more = "block";
						} else {
							app.arts = app.arts.concat(loj.getValue("rows"));
							app.offset += app.limit;
						}
					});
				},
				changeType:function(artTypeId,artTypeName){
					app.artTypeId=artTypeId;
					app.artTypeName=artTypeName;
					app.arts=[];
					app.offset=0;
					app.more = "none";
					app.loadArt();
				}
			},
		});
		app.loadArt();
	</script>

</body>
</html>
